﻿using System;
using System.Collections.Generic;
using System.Text;
using T.FAS.Runtime.Metadata.Entity;

namespace T.FAS.Runtime.Metadata.SPI
{
    /// <summary>
    /// 元数据依赖修复处理
    /// </summary>
    public interface IMetaDependencyHandler
    {
        /// <summary>
        /// 获取元数据依赖关系
        /// </summary>
        /// <param name="metaData"></param>
        /// <returns></returns>
        List<MetaDataDependency> GetMetaDataDependencys(IMetaDataContent metaDataContent);


        /// <summary>
        /// 通过俩元数据获取变更内容
        /// </summary>
        /// <param name="oldMetaData"></param>
        /// <param name="newMetaData"></param>
        /// <returns></returns>
        MetaDataUpdateSet GetMetaDataUpdateSet(IMetaDataContent oldMetaData, IMetaDataContent newMetaData);


        /// <summary>
        /// 通过元数据变更内容更新依赖元数据
        /// </summary>
        /// <param name="metaDataContent">待修复的元数据内容，最终修复成功后保存的也是这个对象</param>
        /// <param name="updateSet">变更元数据内容</param>
        /// <returns></returns>
        MetaUpdateResult UpdateDependencyMetaData(IMetaDataContent metaDataContent, MetaDataUpdateSet updateSet);

        /// <summary>
        /// 构造引用Schema结构
        /// </summary>
        /// <param name="metaDataContent">元数据实体</param>
        /// <returns></returns>
        IRefSchemaEntity BuildRefSchema(IMetaDataContent metaDataContent);

        /// <summary>
        /// 各个元数据提供IRefSchemaEntity的反序列化方法
        /// </summary>
        /// <param name="schemaEntityJson">schemaEntity JSON串</param>
        /// <returns></returns>
        IRefSchemaEntity DeserializeRefSchemaEntity(string schemaEntityJson);
    }
}
